<!DOCTYPE html><html lang="zh-CN" data-theme="dark"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>iOS音视频开发（二）开发库的选择及Mac/Windows环境搭建 | Albert Yuan's Blog</title><meta name="keywords" content="iOS,FFmpeg"><meta name="author" content="Albert Yuan"><meta name="copyright" content="Albert Yuan"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#0d0d0d"><meta name="referrer" content="no-referrer"><meta name="description" content="一、各平台特有音视频开发库 iOS：AVFoundation，AudioUnit等 Android：MediaPlayer、MediaCodec等 Windows：Directshow等   二、跨平台开发库：FFmpeg 音视频开发选择基于C语言的FFmpeg  GUI图形界面的开发选择基于C++的Qt(QtCreator)    三、Mac环境配置1. FFmpeg安装  在Mac环境">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS音视频开发（二）开发库的选择及Mac&#x2F;Windows环境搭建">
<meta property="og:url" content="https://yllove.gitee.io/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/index.html">
<meta property="og:site_name" content="Albert Yuan&#39;s Blog">
<meta property="og:description" content="一、各平台特有音视频开发库 iOS：AVFoundation，AudioUnit等 Android：MediaPlayer、MediaCodec等 Windows：Directshow等   二、跨平台开发库：FFmpeg 音视频开发选择基于C语言的FFmpeg  GUI图形界面的开发选择基于C++的Qt(QtCreator)    三、Mac环境配置1. FFmpeg安装  在Mac环境">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-e68872d834e22ac7b0ed48495df14280_1440w.jpg%3Fsource%3D172ae18b&refer=http%3A%2F%2Fpic2.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630748168&t=1494cc8c3e460d9da07715309293b0b9">
<meta property="article:published_time" content="2021-08-05T09:35:05.476Z">
<meta property="article:modified_time" content="2021-08-18T10:41:09.018Z">
<meta property="article:author" content="Albert Yuan">
<meta property="article:tag" content="iOS">
<meta property="article:tag" content="FFmpeg">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-e68872d834e22ac7b0ed48495df14280_1440w.jpg%3Fsource%3D172ae18b&refer=http%3A%2F%2Fpic2.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630748168&t=1494cc8c3e460d9da07715309293b0b9"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://yllove.gitee.io/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css" media="print" onload="this.media='all'"><script src="https://fastly.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.js" defer></script><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: {"appId":"X8NS0XSX99","apiKey":"b9d4530647c8b5bf7928a04c47752ad7","indexName":"albertyuan","hits":{"per_page":6},"languages":{"input_placeholder":"搜索文章","hits_empty":"找不到您查询的内容：${query}","hits_stats":"找到 ${hits} 条结果，用时 ${time} 毫秒"}},
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://fastly.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://fastly.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://fastly.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://fastly.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'iOS音视频开发（二）开发库的选择及Mac/Windows环境搭建',
  isPost: true,
  isHome: false,
  isHighlightShrink: true,
  isToc: true,
  postUpdate: '2021-08-18 18:41:09'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const fontSizeVal = saveToLocal.get('global-font-size')
    if (fontSizeVal !== undefined) {
      document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
    }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.2.0"><link rel="alternate" href="/blog/atom.xml" title="Albert Yuan's Blog" type="application/atom+xml">
</head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="/blog/img/favicon.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">155</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">56</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">32</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-e68872d834e22ac7b0ed48495df14280_1440w.jpg%3Fsource%3D172ae18b&amp;refer=http%3A%2F%2Fpic2.zhimg.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=jpeg?sec=1630748168&amp;t=1494cc8c3e460d9da07715309293b0b9')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">Albert Yuan's Blog</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">iOS音视频开发（二）开发库的选择及Mac/Windows环境搭建</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-08-05T09:35:05.476Z" title="发表于 2021-08-05 17:35:05">2021-08-05</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-18T10:41:09.018Z" title="更新于 2021-08-18 18:41:09">2021-08-18</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/iOS/">iOS</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/iOS/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/">iOS音视频开发</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2.4k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>8分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="iOS音视频开发（二）开发库的选择及Mac/Windows环境搭建"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><meta name="referrer" content="no-referrer">



<h4 id="一、各平台特有音视频开发库"><a href="#一、各平台特有音视频开发库" class="headerlink" title="一、各平台特有音视频开发库"></a>一、各平台特有音视频开发库</h4><ul>
<li>iOS：AVFoundation，AudioUnit等</li>
<li>Android：MediaPlayer、MediaCodec等</li>
<li>Windows：Directshow等</li>
</ul>
<hr>
<h4 id="二、跨平台开发库：FFmpeg"><a href="#二、跨平台开发库：FFmpeg" class="headerlink" title="二、跨平台开发库：FFmpeg"></a>二、跨平台开发库：<a target="_blank" rel="noopener" href="https://ffmpeg.org/">FFmpeg</a></h4><ul>
<li><p>音视频开发选择基于C语言的FFmpeg</p>
</li>
<li><p>GUI图形界面的开发选择基于C++的Qt(QtCreator)</p>
<hr>
</li>
</ul>
<h4 id="三、Mac环境配置"><a href="#三、Mac环境配置" class="headerlink" title="三、Mac环境配置"></a>三、Mac环境配置</h4><h5 id="1-FFmpeg安装"><a href="#1-FFmpeg安装" class="headerlink" title="1. FFmpeg安装"></a>1. FFmpeg安装</h5><blockquote>
<ul>
<li><p>在Mac环境中，直接使用Homebrew安装FFmpeg即可:  brew install ffmpeg</p>
</li>
<li><p>FFmpeg版本查看: ffmpeg -version</p>
</li>
<li><p>目录结构：</p>
<ol>
<li><p>通过brew install安装的软件会存放到 &#x2F;usr&#x2F;local&#x2F;Cellar 目录中，通过以下命令可以打开FFmpeg的安装目录：</p>
<blockquote>
<p>cd &#x2F;usr&#x2F;local&#x2F;Cellar&#x2F;ffmpeg</p>
</blockquote>
</li>
<li><p>bin：有编译好的可执行程序：ffmpeg、ffplay等，可以直接在命令行上使用，比如:</p>
<blockquote>
<p> ffplay xx.mp4：可以直接播放某个视频</p>
<p>ffmpeg -version：可以查看FFmpeg的版本号</p>
</blockquote>
</li>
<li><p>include：开发时需要包含的头文件</p>
</li>
<li><p>lib：链接时需要用到的库文件</p>
</li>
</ol>
</li>
</ul>
</blockquote>
<hr>
<h5 id="2-Qt安装"><a href="#2-Qt安装" class="headerlink" title="2. Qt安装"></a>2. Qt安装</h5><blockquote>
<ul>
<li><p>通过<em>brew install</em>安装Qt，最终被安装在&#x2F;usr&#x2F;local&#x2F;Cellar&#x2F;qt目录: </p>
<blockquote>
<p>brew install qt</p>
</blockquote>
</li>
<li><p>通过<em>brew install –cask</em>安装Qt Creator，最终被安装在&#x2F;usr&#x2F;local&#x2F;Caskroom&#x2F;qt-creator目录</p>
<blockquote>
<p>brew install –cask qt-creator</p>
</blockquote>
</li>
<li><p>相关配置：通过brew安装的Qt和Qt Creator是分开的，需要在Qt Creator中设置一下Qt的路径,将两者联系起来</p>
</li>
</ul>
</blockquote>
<h6 id="具体配置流程："><a href="#具体配置流程：" class="headerlink" title="具体配置流程："></a>具体配置流程：</h6><p>​	点击Qt Creator的偏好设置：在Qt Versions中添加本地对应的Qt路径</p>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen1.png"></p>
<p>​	<img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen2.png"></p>
<p>Qt的路径是在&#x2F;usr&#x2F;local中，默认是隐藏的:</p>
<ul>
<li>可以使用快捷键Command + Shift + .显示隐藏文件和文件夹</li>
<li>可以使用快捷键Command + Shift + G手动输入Qt的文件夹：&#x2F;usr&#x2F;local&#x2F;Cellar&#x2F;qt</li>
</ul>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen3.png"></p>
<p>选择bin目录下的qmake:</p>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen4.png"></p>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen5.png"></p>
<p>设置64bit那一项为默认开发环境:在Kits选项下设置默认的开发环境，并选择之前设置的指定版本的Qt</p>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen6.png"></p>
<p>滚动到底下，选择刚才设置的Qt版本:</p>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/liuchen7.png"></p>
<hr>
<h5 id="3-开发"><a href="#3-开发" class="headerlink" title="3. 开发"></a>3. 开发</h5><h6 id="3-1新建项目：如图选择"><a href="#3-1新建项目：如图选择" class="headerlink" title="3.1新建项目：如图选择"></a>3.1新建项目：如图选择</h6><p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/develop1.png"></p>
<p>运行后的效果如下图所示：</p>
<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/develop2.png"></p>
<h6 id="3-2-集成FFmpeg到Qt项目中"><a href="#3-2-集成FFmpeg到Qt项目中" class="headerlink" title="3.2 集成FFmpeg到Qt项目中"></a>3.2 集成FFmpeg到Qt项目中</h6><p>集成FFmpeg的操作，修改.pro文件：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"># 设置头文件路径</span><br><span class="line">INCLUDEPATH += /usr/local/Cellar/ffmpeg/4.4/include</span><br><span class="line"></span><br><span class="line"># 设置库文件路径</span><br><span class="line">LIBS += -L/usr/local/Cellar/ffmpeg/4.3.2/lib \</span><br><span class="line">        -lavcodec \</span><br><span class="line">        -lavdevice \</span><br><span class="line">        -lavfilter \</span><br><span class="line">        -lavformat \</span><br><span class="line">        -lavutil \</span><br><span class="line">        -lpostproc \</span><br><span class="line">        -lswscale \</span><br><span class="line">        -lswresample \</span><br><span class="line">        -lavresample</span><br></pre></td></tr></table></figure>

<p>打印FFmpeg版本号：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">#include &quot;mainwindow.h&quot;</span><br><span class="line"></span><br><span class="line">#include &lt;QApplication&gt;</span><br><span class="line">#include &lt;QDebug&gt;</span><br><span class="line"></span><br><span class="line">extern &quot;C&quot; &#123;</span><br><span class="line">#include &lt;libavcodec/avcodec.h&gt;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">int main(int argc, char *argv[]) &#123;</span><br><span class="line">    // 打印版本号</span><br><span class="line">    qDebug() &lt;&lt; av_version_info();</span><br><span class="line"></span><br><span class="line">    QApplication a(argc, argv);</span><br><span class="line">    MainWindow w;</span><br><span class="line">    w.show();</span><br><span class="line">    return a.exec();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><img src= "" data-lazy-src="/blog/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/develop3.png"></p>
<hr>
<hr>
<h4 id="Windows环境配置"><a href="#Windows环境配置" class="headerlink" title="Windows环境配置"></a>Windows环境配置</h4><h3 id="下载"><a href="#下载" class="headerlink" title="下载"></a>下载</h3><p>网上已经有编译好的FFmpeg，目前最新的Release版本是4.3.2，可以直接下载到项目中进行开发使用。</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-github">Windows版本下载</a>：<a target="_blank" rel="noopener" href="https://github.com/GyanD/codexffmpeg/releases/download/4.3.2-2021-02-27/ffmpeg-4.3.2-2021-02-27-full_build-shared.7z">ffmpeg-4.3.2-2021-02-27-full_build-shared.7z</a></li>
<li>源码下载：<a target="_blank" rel="noopener" href="https://ffmpeg.org/releases/ffmpeg-4.3.2.tar.xz">ffmpeg-4.3.2.tar.xz</a><ul>
<li>网上编译好的FFmpeg一般是完整版，体积比较大</li>
<li>日后我们可以根据实际需要，对FFmpeg的源码进行裁剪后再进行重新编译</li>
</ul>
</li>
</ul>
<p>解压<strong>ffmpeg-4.3.2-2021-02-27-full_build-shared.7z</strong>文件后，目录结构如下所示：</p>
<ul>
<li><strong>bin</strong><ul>
<li>有编译好的可执行程序：ffmpeg.exe、ffplay.exe、ffprobe.exe，可以直接在命令行上使用，比如<ul>
<li><em>ffplay xx.mp4</em>：可以直接播放某个视频</li>
<li><em>ffmpeg -version</em>：可以查看FFmpeg的版本号</li>
</ul>
</li>
<li>有运行时需要用到的动态库文件（*.dll）</li>
</ul>
</li>
<li><strong>doc</strong>：FFmpeg的使用文档</li>
<li><strong>include</strong>：开发时需要包含的头文件</li>
<li><strong>lib</strong>：链接时需要用到的库文件</li>
</ul>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100109685-401144677.png" alt="目录结构"></p>
<h2 id="Qt"><a href="#Qt" class="headerlink" title="Qt"></a>Qt</h2><p>如果要想开发一个播放器，肯定得编写界面，同样为了保证跨平台开发，这里采用的GUI库是<a target="_blank" rel="noopener" href="https://www.qt.io/">Qt</a>，官方的开发工具QtCreator是跨平台的（支持Windows、Mac、Linux）。Qt开发采用的编程语言是C++。</p>
<h3 id="下载-1"><a href="#下载-1" class="headerlink" title="下载"></a>下载</h3><p>本教程中选择<em>5.14.2</em>版本（从<em>5.15</em>版本开始是收费版本）。</p>
<ul>
<li>下载地址：<a target="_blank" rel="noopener" href="https://download.qt.io/archive/qt/5.14/5.14.2/">https://download.qt.io/archive/qt/5.14/5.14.2/</a></li>
<li>Windows系统选择下载：<a target="_blank" rel="noopener" href="https://download.qt.io/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe">qt-opensource-windows-x86-5.14.2.exe</a></li>
</ul>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223356865-1879489588.png" alt="qt安装包"></p>
<h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223446602-376823512.png" alt="Next"></p>
<p>需要先注册，再进行登录。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223448612-1507195124.png" alt="先注册，再登录"></p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223450410-1093878860.png" alt="下一步"></p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223452846-307812161.png" alt="下一步"></p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223454495-331255702.png" alt="选择安装路径"></p>
<p>勾选MinGW 64bit编译器（我电脑的系统是64bit）。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223456117-1313660492.png" alt="勾选编译器"></p>
<p>如果后期想阅读Qt源码，就选择勾选Qt源码。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303154753827-460388891.png" alt="勾选源码"></p>
<p>默认已经勾选了QtCreator。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223457841-1880158681.png" alt="默认已经勾选QtCreator"></p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223459568-105685695.png" alt="许可协议"></p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223501405-1820014781.png" alt="开始菜单快捷方式"></p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223503444-2105003129.png" alt="安装"></p>
<h3 id="解决控制台中文乱码"><a href="#解决控制台中文乱码" class="headerlink" title="解决控制台中文乱码"></a>解决控制台中文乱码</h3><p>工具 -&gt; 选项。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223542462-1404459733.png"></p>
<p>文本编辑器 -&gt; 行为 -&gt; 文本编码 -&gt; 默认编码。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210301223544116-1548051098.png" alt="设置为UTF-8"></p>
<h2 id="开发初探"><a href="#开发初探" class="headerlink" title="开发初探"></a>开发初探</h2><h3 id="第一个Qt项目"><a href="#第一个Qt项目" class="headerlink" title="第一个Qt项目"></a>第一个Qt项目</h3><p>打开QtCreator，文件 -&gt; 新建文件或项目。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100337496-1819818685.png" alt="新建项目"></p>
<p>Application -&gt; Qt Widgets Application。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100339554-1027670443.png" alt="Qt Widgets Application"></p>
<p>设置项目名称和项目的存放路径。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100341452-1760777115.png" alt="项目名称和项目的存放路径"><br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100344890-990895790.png" alt="下一步"></p>
<p>QtCreator默认会创建一个MainWindow类（主窗口）。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100452551-1579725199.png" alt="下一步"><br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100454228-2065381027.png" alt="下一步"></p>
<p>勾选MinGW编译器。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100455958-1241447130.png" alt="下一步"><br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100458057-274318672.png" alt="完成"></p>
<p>双击打开<strong>mainwindow.ui</strong>文件，可以往右边的主窗口中添加一些界面元素（比如按钮）。<br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100509272-1615603672.png" alt="双击打开mainwindow.ui文件"><br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100511129-245180460.png" alt="拖拽"></p>
<p>点击左下角的运行按钮（绿色三角形），即可看到一个窗口界面，这个就是QtCreator默认创建的主窗口（MainWindow对象）。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100520847-1054974024.png"><br><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100522293-1578268250.png"></p>
<h3 id="消除警告"><a href="#消除警告" class="headerlink" title="消除警告"></a>消除警告</h3><p>每次运行Qt程序，你的控制台可能都会出现以下警告信息：<strong>QT_DEVICE_PIXEL_RATIO</strong>已经过期。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:</span><br><span class="line">   QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors.</span><br><span class="line">   QT_SCREEN_SCALE_FACTORS to set per-screen DPI.</span><br><span class="line">   QT_SCALE_FACTOR to set the application global scale factor.</span><br></pre></td></tr></table></figure>

<p>解决方案：设置环境变量<strong>QT_SCALE_FACTOR</strong>为1即可。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&quot;mainwindow.h&quot;</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;QApplication&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 导入头文件【也可以不导入，因为&lt;QApplication&gt;中已经包含了&lt;QByteArray&gt;】</span></span><br><span class="line"><span class="comment">// #include &lt;QByteArray&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span> </span>&#123;</span><br><span class="line">    <span class="comment">// 通过qputenv函数设置QT_SCALE_FACTOR为1</span></span><br><span class="line">    <span class="built_in">qputenv</span>(<span class="string">&quot;QT_SCALE_FACTOR&quot;</span>, <span class="built_in">QByteArray</span>(<span class="string">&quot;1&quot;</span>));</span><br><span class="line"></span><br><span class="line">    <span class="function">QApplication <span class="title">a</span><span class="params">(argc, argv)</span></span>;</span><br><span class="line">    MainWindow w;</span><br><span class="line">    w.<span class="built_in">show</span>();</span><br><span class="line">    <span class="keyword">return</span> a.<span class="built_in">exec</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="集成FFmpeg到Qt项目中"><a href="#集成FFmpeg到Qt项目中" class="headerlink" title="集成FFmpeg到Qt项目中"></a>集成FFmpeg到Qt项目中</h3><p>在Windows中，我们最终是通过调用FFmpeg动态库（dll）中的函数来操作音视频数据，使用dll的其中一种方式是需要用到3种文件：</p>
<ul>
<li><strong>.h</strong>：头文件（Header File）<ul>
<li>包含了函数的声明</li>
<li>通过*#include*去导入相应的头文件</li>
</ul>
</li>
<li><strong>.dll</strong>：动态链接库（Dynamic Link Library）<ul>
<li>包含了函数的具体实现代码</li>
<li>Windows程序会在运行过程中，动态调用dll中的函数</li>
</ul>
</li>
<li><strong>.lib</strong>或**.dll.a**：（动态链接库的）导入库（Import Library）<ul>
<li><strong>.lib</strong>：用于MSVC编译器中</li>
<li><strong>.dll.a</strong>：用于MinGW编译器中</li>
<li>包含了dll中函数的入口，用于辅助找到并调用dll中的函数</li>
<li>最终需要链接到Windows程序中（比如合并到exe文件中）</li>
</ul>
</li>
</ul>
<p>值得一提的是，在Windows中，静态链接库（Static Link Library）的扩展名也是**.lib<strong>、</strong>.dll.a**。静态链接库和导入库的区别是：</p>
<ul>
<li>静态链接库：包含了函数的具体实现代码</li>
<li>导入库：不包含函数的具体实现代码（函数的具体实现代码存储在dll中）</li>
</ul>
<h4 id="修改-pro-文件"><a href="#修改-pro-文件" class="headerlink" title="修改**.pro**文件"></a>修改**.pro**文件</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置头文件的目录，以便编译器能够找到头文件</span></span><br><span class="line">INCLUDEPATH += %FFMPEG_HOME%/include</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置导入库的目录和需要链接的导入库</span></span><br><span class="line">LIBS += -L%FFMPEG_HOME%/lib \</span><br><span class="line">        -lavcodec \</span><br><span class="line">        -lavdevice \</span><br><span class="line">        -lavfilter \</span><br><span class="line">        -lavformat \</span><br><span class="line">        -lavutil \</span><br><span class="line">        -lpostproc \</span><br><span class="line">        -lswscale \</span><br><span class="line">        -lswresample</span><br></pre></td></tr></table></figure>

<ul>
<li>#号后面的内容是注释</li>
<li><strong>%FFMPEG_HOME%<strong>表示</strong>ffmpeg-4.3.2-2021-02-27-full_build-shared.7z</strong>解压后的目录<ul>
<li>需要根据你的实际情况修改为真实的路径</li>
</ul>
</li>
<li><strong>-L</strong>：设置导入库的目录，以便编译器能够找到导入库</li>
<li><strong>-l</strong>：设置需要链接的导入库名称<ul>
<li>导入库名称需要去掉文件名前面的lib，比如libavcodec.dll.a就写成avcodec</li>
</ul>
</li>
</ul>
<h4 id="调用函数"><a href="#调用函数" class="headerlink" title="调用函数"></a>调用函数</h4><p>在<strong>main.cpp</strong>中调用<em>av_version_info</em>函数，获取FFmpeg的版本信息。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&quot;mainwindow.h&quot;</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;QApplication&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 为了使用qDebug函数</span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;QDebug&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment">// FFmpeg是C语言库</span></span><br><span class="line"><span class="comment">// 有了extern &quot;C&quot;，才能在C++中导入C语言函数</span></span><br><span class="line"><span class="keyword">extern</span> <span class="string">&quot;C&quot;</span> &#123;</span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;libavcodec/avcodec.h&gt;</span></span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span> </span>&#123;</span><br><span class="line">    <span class="comment">// 打印版本信息</span></span><br><span class="line">    <span class="built_in">qDebug</span>() &lt;&lt; <span class="built_in">av_version_info</span>();</span><br><span class="line">    </span><br><span class="line">    <span class="function">QApplication <span class="title">a</span><span class="params">(argc, argv)</span></span>;</span><br><span class="line">    MainWindow w;</span><br><span class="line">    w.<span class="built_in">show</span>();</span><br><span class="line">    <span class="keyword">return</span> a.<span class="built_in">exec</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="拷贝dll文件"><a href="#拷贝dll文件" class="headerlink" title="拷贝dll文件"></a>拷贝dll文件</h4><p>Qt程序编译成功后，会生成一个exe文件</p>
<ul>
<li>exe是Windows中的一种可执行文件</li>
<li>我们编写的程序代码最终都存在了exe文件中</li>
</ul>
<p>为了保证exe在运行时能成功调用FFmpeg的函数，那么就得让exe能够找到FFmpeg的dll文件（动态库文件）。可以将**%FFMPEG_HOME%&#x2F;bin**目录中的所有dll文件拷贝到exe文件所在的目录中，exe在运行的时候，能自动找到跟它同一目录下的dll文件。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100542709-187646790.png"></p>
<p>可以通过查看构建目录得知exe文件所在的目录。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100555098-1663556108.png"></p>
<p>运行程序后，如果能在控制台看到<strong>4.3.2</strong>字样的输出信息，说明FFmpeg已经集成成功。</p>
<p><img src= "" data-lazy-src="https://img2020.cnblogs.com/blog/497279/202103/497279-20210303100603623-1729439411.png"></p>
<h4 id="根据dll在Windows中的搜索顺序，将所需的动态库设置成“系统动态库”"><a href="#根据dll在Windows中的搜索顺序，将所需的动态库设置成“系统动态库”" class="headerlink" title="根据dll在Windows中的搜索顺序，将所需的动态库设置成“系统动态库”"></a>根据dll在Windows中的搜索顺序，将所需的动态库设置成“系统动态库”</h4><p>exe在寻找dll文件时，大概按照以下优先级顺序去查找（这里只列出了大概的搜索路径，并没有写全）：</p>
<ol>
<li><p>exe所在的目录</p>
</li>
<li><p>Windows的System目录</p>
<ul>
<li>C:&#x2F;Windows&#x2F;System</li>
<li>C:&#x2F;Windows&#x2F;System32</li>
</ul>
</li>
<li><p>Windows目录</p>
<ul>
<li>C:&#x2F;Windows</li>
</ul>
</li>
<li><p><strong>环境变量Path中的路径</strong></p>
<ul>
<li><p>所以可以考虑将**%FFMPEG_HOME%&#x2F;bin**目录配置到Path变量中</p>
</li>
<li><p>置于如何配置Windows的环境变量Path，这是基本开发常识了，就不再讲解了</p>
<blockquote>
<p>Windows的环境变量Path: 此电脑—-属性—–高级—-环境变量：添加路径</p>
</blockquote>
</li>
</ul>
</li>
</ol>
<p>第1种方式需要在每一个Qt程序中都拷贝一份FFmpeg的dll文件，第2~4种方式可以让多个Qt程序共用同一份FFmpeg的dll文件。</p>
<h3 id="pro文件"><a href="#pro文件" class="headerlink" title=".pro文件"></a>.pro文件</h3><p>.pro文件是Qt项目的   <strong>主配置文件</strong>  。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">包含了core、gui两个模块</span></span><br><span class="line">QT       += core gui</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">高于4版本，就包含widgets模块</span></span><br><span class="line">greaterThan(QT_MAJOR_VERSION, 4): QT += widgets</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启用c++11版本语法</span></span><br><span class="line">CONFIG += c++11</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">源代码</span></span><br><span class="line">SOURCES += \</span><br><span class="line">    main.cpp \</span><br><span class="line">    mainwindow.cpp</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">头文件</span></span><br><span class="line">HEADERS += \</span><br><span class="line">    mainwindow.h</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">ui文件</span></span><br><span class="line">FORMS += \</span><br><span class="line">    mainwindow.ui</span><br></pre></td></tr></table></figure>

<h3 id="常用快捷键"><a href="#常用快捷键" class="headerlink" title="常用快捷键"></a>常用快捷键</h3><ul>
<li>字体缩放：Ctrl + 鼠标滚轮</li>
<li>帮助文档：F1</li>
<li>注释：Ctrl + &#x2F;</li>
<li>同名的.h、.cpp文件之间切换：F4</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">Albert Yuan</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://yllove.gitee.io/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/">https://yllove.gitee.io/2021/08/05/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91/iOS%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E4%BA%8C/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://yllove.gitee.io" target="_blank">Albert Yuan's Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/iOS/">iOS</a><a class="post-meta__tags" href="/blog/tags/FFmpeg/">FFmpeg</a></div><div class="post_share"><div class="social-share" data-image="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-e68872d834e22ac7b0ed48495df14280_1440w.jpg%3Fsource%3D172ae18b&amp;refer=http%3A%2F%2Fpic2.zhimg.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=jpeg?sec=1630748168&amp;t=1494cc8c3e460d9da07715309293b0b9" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://fastly.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/2021/08/05/Swift/swift%E5%B8%B8%E7%94%A8%E4%B8%89%E6%96%B9%E5%BA%93/"><img class="prev-cover" src= "" data-lazy-src="https://photos.infinum.com/store/b558bd40787ecad225d9c66322f14522" onerror="onerror=null;src='/blog/img/defaultCover.gif'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">swift常用三方库</div></div></a></div><div class="next-post pull-right"><a href="/blog/2021/08/06/iOS/Undefined-symbol-OBJC-CLASS/"><img class="next-cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fuser-images.githubusercontent.com%2F6682655%2F78047809-75640800-7396-11ea-8925-5e180dabf2e0.png&amp;refer=http%3A%2F%2Fuser-images.githubusercontent.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=jpeg?sec=1630822158&amp;t=8eccbfea06e2cb6b293966f1a33f5476" onerror="onerror=null;src='/blog/img/defaultCover.gif'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Undefined_symbol:_OBJC_CLASS_xxx解决方法</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/blog/2021/08/10/iOS音视频开发/iOS音视频开发三Qt基础/" title="iOS音视频开发（三）Qt基础"><img class="cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimgsa.baidu.com%2Fexp%2Fw%3D500%2Fsign%3D58e2c752718b4710ce2ffdccf3cec3b2%2Fac4bd11373f08202b8ecae4c48fbfbedab641b42.jpg&refer=http%3A%2F%2Fimgsa.baidu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1631169901&t=f2413d6f3a43f8af71618af5619791e2" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-08-10</div><div class="title">iOS音视频开发（三）Qt基础</div></div></a></div><div><a href="/blog/2021/08/10/iOS音视频开发/iOS音视频开发四重识音频/" title="iOS音视频开发（四）重识音频"><img class="cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.ooopic.com%2F15%2F18%2F53%2F16bOOOPIC32_1024.jpg%21%2Ffw%2F780%2Fquality%2F90%2Funsharp%2Ftrue%2Fcompress%2Ftrue&refer=http%3A%2F%2Fbpic.ooopic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1631154236&t=41dee32ac306672aa6785a6d138a850b" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-08-10</div><div class="title">iOS音视频开发（四）重识音频</div></div></a></div><div><a href="/blog/2022/04/21/iOS音视频开发/ios-AVFoundation-视频播放/ios-AVFoundation-视频播放/" title="ios_AVFoundation_视频播放"><img class="cover" src= "" data-lazy-src="/blog/img/defaultCover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-04-21</div><div class="title">ios_AVFoundation_视频播放</div></div></a></div><div><a href="/blog/2021/09/26/iOS UIKIt/UIDynamic动态物理引擎/" title="UIDynamic动态物理引擎"><img class="cover" src= "" data-lazy-src="https://img0.baidu.com/it/u=1254289242,26520186&fm=26&fmt=auto" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-09-26</div><div class="title">UIDynamic动态物理引擎</div></div></a></div><div><a href="/blog/2021/09/08/iOS UIKIt/UIViewContentMode属性详解/" title="UIViewContentMode属性详解"><img class="cover" src= "" data-lazy-src="https://img1.baidu.com/it/u=2815189064,4171169784&fm=26&fmt=auto&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-09-08</div><div class="title">UIViewContentMode属性详解</div></div></a></div><div><a href="/blog/2021/09/24/iOS UIKIt/iOSUIKit之UIWindow详解/" title="iOSUIKit之UIWindow详解"><img class="cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimages2018.cnblogs.com%2Fblog%2F749924%2F201807%2F749924-20180730112644434-125751676.png&refer=http%3A%2F%2Fimages2018.cnblogs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1635046008&t=fd235aaa9fc1476b26197b2443c90864" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-09-24</div><div class="title">iOSUIKit之UIWindow详解</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="/blog/img/favicon.png" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Albert Yuan</div><div class="author-info__description">博学之,审问之,慎思之,明辨之,笃行之</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">155</div></a></div><div class="card-info-data-item is-center"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">56</div></a></div><div class="card-info-data-item is-center"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">32</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/yuanliangYL"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/yuanliangYL" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:yuanliangios@163.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="qq:1023817403" target="_blank" title="QQ"><i class="fab fa-qq"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">love cat , love life</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%80%E3%80%81%E5%90%84%E5%B9%B3%E5%8F%B0%E7%89%B9%E6%9C%89%E9%9F%B3%E8%A7%86%E9%A2%91%E5%BC%80%E5%8F%91%E5%BA%93"><span class="toc-text">一、各平台特有音视频开发库</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BA%8C%E3%80%81%E8%B7%A8%E5%B9%B3%E5%8F%B0%E5%BC%80%E5%8F%91%E5%BA%93%EF%BC%9AFFmpeg"><span class="toc-text">二、跨平台开发库：FFmpeg</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%89%E3%80%81Mac%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE"><span class="toc-text">三、Mac环境配置</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-FFmpeg%E5%AE%89%E8%A3%85"><span class="toc-text">1. FFmpeg安装</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-Qt%E5%AE%89%E8%A3%85"><span class="toc-text">2. Qt安装</span></a><ol class="toc-child"><li class="toc-item toc-level-6"><a class="toc-link" href="#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B%EF%BC%9A"><span class="toc-text">具体配置流程：</span></a></li></ol></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-%E5%BC%80%E5%8F%91"><span class="toc-text">3. 开发</span></a><ol class="toc-child"><li class="toc-item toc-level-6"><a class="toc-link" href="#3-1%E6%96%B0%E5%BB%BA%E9%A1%B9%E7%9B%AE%EF%BC%9A%E5%A6%82%E5%9B%BE%E9%80%89%E6%8B%A9"><span class="toc-text">3.1新建项目：如图选择</span></a></li><li class="toc-item toc-level-6"><a class="toc-link" href="#3-2-%E9%9B%86%E6%88%90FFmpeg%E5%88%B0Qt%E9%A1%B9%E7%9B%AE%E4%B8%AD"><span class="toc-text">3.2 集成FFmpeg到Qt项目中</span></a></li></ol></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Windows%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE"><span class="toc-text">Windows环境配置</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD"><span class="toc-text">下载</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Qt"><span class="toc-text">Qt</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD-1"><span class="toc-text">下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85"><span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%A7%A3%E5%86%B3%E6%8E%A7%E5%88%B6%E5%8F%B0%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81"><span class="toc-text">解决控制台中文乱码</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E5%8F%91%E5%88%9D%E6%8E%A2"><span class="toc-text">开发初探</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E4%B8%AAQt%E9%A1%B9%E7%9B%AE"><span class="toc-text">第一个Qt项目</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B6%88%E9%99%A4%E8%AD%A6%E5%91%8A"><span class="toc-text">消除警告</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%9B%86%E6%88%90FFmpeg%E5%88%B0Qt%E9%A1%B9%E7%9B%AE%E4%B8%AD"><span class="toc-text">集成FFmpeg到Qt项目中</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9-pro-%E6%96%87%E4%BB%B6"><span class="toc-text">修改**.pro**文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%B0%83%E7%94%A8%E5%87%BD%E6%95%B0"><span class="toc-text">调用函数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%8B%B7%E8%B4%9Ddll%E6%96%87%E4%BB%B6"><span class="toc-text">拷贝dll文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%B9%E6%8D%AEdll%E5%9C%A8Windows%E4%B8%AD%E7%9A%84%E6%90%9C%E7%B4%A2%E9%A1%BA%E5%BA%8F%EF%BC%8C%E5%B0%86%E6%89%80%E9%9C%80%E7%9A%84%E5%8A%A8%E6%80%81%E5%BA%93%E8%AE%BE%E7%BD%AE%E6%88%90%E2%80%9C%E7%B3%BB%E7%BB%9F%E5%8A%A8%E6%80%81%E5%BA%93%E2%80%9D"><span class="toc-text">根据dll在Windows中的搜索顺序，将所需的动态库设置成“系统动态库”</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#pro%E6%96%87%E4%BB%B6"><span class="toc-text">.pro文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="toc-text">常用快捷键</span></a></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/2023/02/07/iOS%E5%BC%80%E5%8F%91%E8%BF%9B%E9%98%B6/iOS-%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BD%91%E9%A1%B5%E4%B8%8B%E8%BD%BDIPA%E5%8C%85/" title="iOS 自定义网页下载IPA包"><img src= "" data-lazy-src="https://img.mp.itc.cn/upload/20170409/1a8f793d7282451cbd1beb6841608c90_th.jpeg" onerror="this.onerror=null;this.src='/blog/img/defaultCover.gif'" alt="iOS 自定义网页下载IPA包"/></a><div class="content"><a class="title" href="/blog/2023/02/07/iOS%E5%BC%80%E5%8F%91%E8%BF%9B%E9%98%B6/iOS-%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BD%91%E9%A1%B5%E4%B8%8B%E8%BD%BDIPA%E5%8C%85/" title="iOS 自定义网页下载IPA包">iOS 自定义网页下载IPA包</a><time datetime="2023-02-07T02:46:29.851Z" title="更新于 2023-02-07 10:46:29">2023-02-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2023/02/06/Flutter/Flutter%E6%8E%A5%E5%85%A5%E5%8E%9F%E7%94%9F-iOS/" title="flutter接入原生-iOS"><img src= "" data-lazy-src="https://pic4.zhimg.com/v2-6a115fea4db1ad770dccf4119bfab36f_1440w.jpg?source=172ae18b" onerror="this.onerror=null;this.src='/blog/img/defaultCover.gif'" alt="flutter接入原生-iOS"/></a><div class="content"><a class="title" href="/blog/2023/02/06/Flutter/Flutter%E6%8E%A5%E5%85%A5%E5%8E%9F%E7%94%9F-iOS/" title="flutter接入原生-iOS">flutter接入原生-iOS</a><time datetime="2023-02-07T01:18:53.661Z" title="更新于 2023-02-07 09:18:53">2023-02-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/12/17/iOS%E5%BC%80%E5%8F%91%E8%BF%9B%E9%98%B6/iOS%20%E5%A6%82%E4%BD%95%E5%9C%A8%E6%A8%A1%E6%8B%9F%E5%99%A8%E4%B8%AD%E5%AE%89%E8%A3%85APP/" title="iOS 如何在模拟器中安装APP"><img src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.winwin7.com%2Fuploadfile%2F2021%2F0114%2F20210114141748239.jpg&amp;refer=http%3A%2F%2Fwww.winwin7.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1673854539&amp;t=aad2108ffb799b04e94a28cc58f038f1" onerror="this.onerror=null;this.src='/blog/img/defaultCover.gif'" alt="iOS 如何在模拟器中安装APP"/></a><div class="content"><a class="title" href="/blog/2022/12/17/iOS%E5%BC%80%E5%8F%91%E8%BF%9B%E9%98%B6/iOS%20%E5%A6%82%E4%BD%95%E5%9C%A8%E6%A8%A1%E6%8B%9F%E5%99%A8%E4%B8%AD%E5%AE%89%E8%A3%85APP/" title="iOS 如何在模拟器中安装APP">iOS 如何在模拟器中安装APP</a><time datetime="2022-12-17T07:48:56.594Z" title="更新于 2022-12-17 15:48:56">2022-12-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2021/08/05/Swift/swift%E5%B8%B8%E7%94%A8%E4%B8%89%E6%96%B9%E5%BA%93/" title="swift常用三方库"><img src= "" data-lazy-src="https://photos.infinum.com/store/b558bd40787ecad225d9c66322f14522" onerror="this.onerror=null;this.src='/blog/img/defaultCover.gif'" alt="swift常用三方库"/></a><div class="content"><a class="title" href="/blog/2021/08/05/Swift/swift%E5%B8%B8%E7%94%A8%E4%B8%89%E6%96%B9%E5%BA%93/" title="swift常用三方库">swift常用三方库</a><time datetime="2022-12-16T06:37:20.115Z" title="更新于 2022-12-16 14:37:20">2022-12-16</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/12/12/iOS%E5%BC%80%E5%8F%91%E8%BF%9B%E9%98%B6/GCD%E8%BF%9B%E9%98%B6%E4%B9%8BDispatchWorkItem%E5%92%8CDispatchGroup/" title="GCD进阶之DispatchWorkItem和DispatchGroup"><img src= "" data-lazy-src="/blog/img/defaultCover.png" onerror="this.onerror=null;this.src='/blog/img/defaultCover.gif'" alt="GCD进阶之DispatchWorkItem和DispatchGroup"/></a><div class="content"><a class="title" href="/blog/2022/12/12/iOS%E5%BC%80%E5%8F%91%E8%BF%9B%E9%98%B6/GCD%E8%BF%9B%E9%98%B6%E4%B9%8BDispatchWorkItem%E5%92%8CDispatchGroup/" title="GCD进阶之DispatchWorkItem和DispatchGroup">GCD进阶之DispatchWorkItem和DispatchGroup</a><time datetime="2022-12-12T07:19:37.277Z" title="更新于 2022-12-12 15:19:37">2022-12-12</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-e68872d834e22ac7b0ed48495df14280_1440w.jpg%3Fsource%3D172ae18b&amp;refer=http%3A%2F%2Fpic2.zhimg.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=jpeg?sec=1630748168&amp;t=1494cc8c3e460d9da07715309293b0b9')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By Albert Yuan</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcom to my  blog</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="algolia-search"><div class="search-dialog"><div class="search-dialog__title" id="algolia-search-title">Algolia</div><div id="algolia-input-panel"><div id="algolia-search-input"></div></div><hr/><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-stats"></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="https://fastly.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/blog/js/search/algolia.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    chtml: {
      scale: 1.2
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        insertScript: [200, () => {
          document.querySelectorAll('mjx-container:not\([display]\)').forEach(node => {
            const target = node.parentNode
            if (target.nodeName.toLowerCase() === 'li') {
              target.parentNode.classList.add('has-jax')
            } else {
              target.classList.add('has-jax')
            }
          });
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://fastly.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'REc8eytE1gJDl3d8FkudLNlL-gzGzoHsz',
      appKey: 'gGO3y8I9oVlc4Cd5N1fizNPW',
      avatar: 'monsterid',
      serverURLs: '',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://fastly.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !true) {
  if (true) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://fastly.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="canvas_nest" defer="defer" color="255,0,0" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://fastly.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script><script src="https://fastly.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = true;
document.body.addEventListener('input', POWERMODE);
</script><script id="click-heart" src="https://fastly.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="false"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>